package example.step2;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class PrimaryRange {
    public static void main(String args[]) throws Exception{
        ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(
                "E:\\idea-workspace\\gitee\\demo\\serializable\\src\\main\\java\\objfile\\primaryrange.obj"));
        // 针对Short的序列化
        out.writeShort(80000);
        // 针对Char的序列化
        out.writeChar(70000);
        out.close();
        // 反序列化对象
        ObjectInputStream in = new ObjectInputStream(new FileInputStream(
                "E:\\idea-workspace\\gitee\\demo\\serializable\\src\\main\\java\\objfile\\primaryrange.obj"));
        // 数据的反序列化读取
        System.out.println(in.readShort());
        System.out.println(in.readChar());
        in.close();
    }
}